<?php
session_start();
?>
<html>


<head>



<?php
include('head.php');
?>
 <script type="text/javascript">

var imgs = ["d.jpg",
            "e.jpg",
            "f.jpg"];
var imageIndex=1;
function slideImage()
{
    $("#bigImage").fadeOut("slow", function() {
        $(this).attr("src", imgs[imageIndex]).fadeIn("slow");
        if(++imageIndex>=imgs.length)
            imageIndex=0;
    });
}

$(function()
{
    

    var $bigImage=$("#bigImage");
    $(".thumbnail").mouseover(function()
    {
        $(this).fadeTo("fast",0.5);
        var src=$(this).attr("src");
        $bigImage.fadeOut("fast",function()
        {
            $bigImage.attr("src",src);
        });
        $bigImage.fadeIn("fast");
    });
    $(".thumbnail").mouseleave(function()
    {
        $(this).fadeTo("fast",1);
    });
});
</script>
<script type = "text/javascript">
$(document).ready(function(){
$("#form_TK").submit(function(){ // id form
		var HangSX = $("#HangSX").val();	// tên combobox
		var Mang = $("#Mang").val();
		var KieuDang = $("#KieuDang").val();
		var KichThuoc = $("#KichThuoc").val();
		var TrongLuong = $("#TrongLuong").val();
		var ManHinh = $("#ManHinh").val();
		var DoPhanGiai = $("#DoPhanGiai").val();
		var ThongBao = $("#ThongBao").val();
		var Rung = $("#Rung").val();
		var LoaiTheNho = $("#LoaiTheNho").val();
		var BoNhoTrong = $("#BoNhoTrong").val();
		var TinNhan = $("#TinNhan").val();
		var GPRS = $("#GPRS").val();
		var EDGE = $("#EDGE").val();
		var HoTro3G = $("#HoTro3G").val();
		var TrinhDuyet = $("#TrinhDuyet").val();
		var Bluetooth = $("#Bluetooth").val();
		var Wifi = $("#Wifi").val();
		var CongUSB = $("#CongUSB").val();
		var Camera = $("#Camera").val();
		var Mau = $("#Mau").val();
		var HeDieuHanh = $("#heDieuHanh").val();
		var Pin = $("#Pin").val();
		var ThoiGianDamThoai = $("#ThoiGianDamThoai").val();
		var ThoiGianCho = $("#ThoiGianCho").val();
		 
		
		$.ajax({
				type: "POST",
				url: "search.php", // file xử lý
				data: "HangSX="+ HangSX+"&Mang="+Mang+"&KieuDang="+KieuDang+"&KichThuoc="+KichThuoc+"&TrongLuong="+TrongLuong+"&ManHinh="+ManHinh+"&DoPhanGiai="+DoPhanGiai+"&ThongBao="+ThongBao+"&Rung="+Rung+"&LoaiTheNho="+LoaiTheNho+"&BoNhoTrong="+BoNhoTrong+"&TinNhan="+TinNhan+"&GPRS="+GPRS+"&EDGE="+EDGE+"&HoTro3G="+HoTro3G+"&TrinhDuyet="+TrinhDuyet+"&Bluetooth="+Bluetooth+"&Wifi="+Wifi+"&CongUSB="+CongUSB+"&Camera="+Camera+"&Mau="+Mau+"&HeDieuHanh="+HeDieuHanh+"&Pin="+Pin+"&ThoiGianDamThoai="+ThoiGianDamThoai+"&ThoiGianCho="+ThoiGianCho, 
				success: function(result){$('#pro5').html(result);}
			});
		return false;
	});
	}); 
</script>
 
 


</head>
<body>

<?php
include ('dbcon.php');
include ('webtitle.php');
include ('topbannermenu.php');
include ('leftmenu.php');
?>	







<div id = "divMid2">
<div id = "pro4">
   <?php
	$connect=mysql_connect("localhost","root","") or die("Can not connect database");
   mysql_select_db("dtdd",$connect);
   mysql_query("SET NAMES 'utf8'", $connect);
		 ?>
        <form id = "form_TK" method="POST" name = "form_TK" action="search.php">
        <center>
        <table align="center" border = "1px">
        <tr>
        <td colspan="5" align="center"><br> Tìm kiếm nâng cao <br><br></td>
        <tr>
        <td align="left">
        <select name = "HangSX" id = "HangSX" >
        <option value = "0"> Chọn Hãng </option>  
        <?php
			$sql1 = mysql_query("select chitietdd.mact, chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 1");
			while ($rows1 = mysql_fetch_array($sql1))
			{
				echo "<option value='$rows1[0]'> $rows1[1] </option>";	
			}		
		 ?>
        </select><br><br>
       
        </td>
        <td align="left">
        <select name = "Mang" id = "Mang" >
        <option value = "0"> Chọn Mạng </option>  
        <?php
			$sql2 = mysql_query("select chitietdd.mact, chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 2");
			while ($rows2 = mysql_fetch_array($sql2))
			{
				echo "<option value='$rows2[0]'> $rows2[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
        
        <td align="left">
        <select name = "KieuDang" id = "KieuDang" >
        <option value = "0"> Chọn Kiểu Dáng </option>  
        <?php
			$sql3 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 3");
			while ($rows3 = mysql_fetch_array($sql3))
			{
				echo "<option value='$rows3[0]'> $rows3[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
        
        <td align="left">
        <select name = "ThoiGianDamThoai" id = "ThoiGianDamThoai" >
        <option value = "0"> Thời Gian Đàm Thoại </option>  
        <?php
			$sql24 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 24");
			while ($rows24 = mysql_fetch_array($sql24))
			{
				echo "<option value='$rows24[0]'> $rows24[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
        </tr>
        <tr>

<td align="left">
        <select name = "Pin" id = "Pin" >
        <option value = "0"> Chọn Pin </option>  
        <?php
			$sql23 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 23");
			while ($rows23 = mysql_fetch_array($sql23))
			{
				echo "<option value='$rows23[0]'> $rows23[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
<td align="left">
        <select name = "Mau" id = "Mau" >
        <option value = "0"> Chọn Màu </option>  
        <?php
			$sql21 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 21");
			while ($rows21 = mysql_fetch_array($sql21))
			{
				echo "<option value='$rows21[0]'> $rows21[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
	

<td align="left">
        <select name = "DoPhanGiai" id = "DoPhanGiai" >
        <option value = "0"> Chọn Độ Phân Giải </option>  
        <?php
			$sql7 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 7");
			while ($rows7 = mysql_fetch_array($sql7))
			{
				echo "<option value='$rows7[0]'> $rows7[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>

<td align="left">
        <select name = "ThongBao" id = "ThongBao" >
        <option value = "0"> Chọn Thông Báo </option>  
        <?php
			$sql8 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 8");
			while ($rows8 = mysql_fetch_array($sql8))
			{
				echo "<option value='$rows8[0]'> $rows8[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
        </tr>
        <tr>
 <td align="left">
        <select name = "HeDieuHanh" id = "heDieuHanh" >
        <option value = "0"> Chọn Hệ Điều Hành </option>  
        <?php
			$sql22 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 22");
			while ($rows22 = mysql_fetch_array($sql22))
			{
				echo "<option value='$rows22[0]'> $rows22[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>


<td align="left">
        <select name = "KichThuoc" id = "KichThuoc" >
        <option value = "0"> Chọn Kích Thước </option>  
        <?php
			$sql4 = mysql_query("select chitietdd.mact, chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 4");
			while ($rows4 = mysql_fetch_array($sql4))
			{
				echo "<option value='$rows4[0]'> $rows4[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>

        
        <td align="left">
        <select name = "TinNhan" id = "TinNhan" >
        <option value = "0"> Tin Nhắn </option>  
        <?php
			$sql12 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 12");
			while ($rows12 = mysql_fetch_array($sql12))
			{
				echo "<option value='$rows12[0]'> $rows12[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
        <td align="left">
        <select name = "Wifi" id = "Wifi" >
        <option value = "0"> Chọn Wifi </option>  
        <?php
			$sql18 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 18");
			while ($rows18 = mysql_fetch_array($sql18))
			{
				echo "<option value='$rows18[0]'> $rows18[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
	</tr>
    <tr>

<td align="left">
        <select name = "ThoiGianCho" id = "ThoiGianCho" >
        <option value = "0"> Thời Gian Chờ </option>  
        <?php
			$sql25 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 25");
			while ($rows25 = mysql_fetch_array($sql25))
			{
				echo "<option value='$rows25[0]'> $rows25[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
	<td align="left">
        <select name = "HoTro3G" id = "HoTro3G" >
        <option value = "0"> Hỗ Trợ 3G </option>  
        <?php
			$sql15 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 15");
			while ($rows15 = mysql_fetch_array($sql15))
			{
				echo "<option value='$rows15[0]'> $rows15[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
        <td align="left">
        <select name = "LoaiTheNho" id = "LoaiTheNho" >
        <option value = "0"> Chọn Thẻ Nhớ </option>  
        <?php
			$sql10 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 10");
			while ($rows10 = mysql_fetch_array($sql10))
			{
				echo "<option value='$rows10[0]'> $rows10[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
       <td align="left">
        <select name = "Rung" id = "Rung" >
        <option value = "0"> Chọn Rung </option>  
        <?php
			$sql9 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 9");
			while ($rows9 = mysql_fetch_array($sql9))
			{
				echo "<option value='$rows9[0]'> $rows9[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
        </tr>
        <tr>
	<td align="left">
        <select name = "TrinhDuyet" id = "TrinhDuyet" >
        <option value = "0"> Chọn Trình Duyệt </option>  
        <?php
			$sql16 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 16");
			while ($rows16 = mysql_fetch_array($sql16))
			{
				echo "<option value='$rows16[0]'> $rows16[1] </option>";	
			}	 	
		 ?>
        </select><br><br>
        </td>
	<td align="left">
        <select name = "BoNhoTrong" id = "BoNhoTrong" >
        <option value = "0"> Bộ Nhớ Trong </option>  
        <?php
			$sql11 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 11");
			while ($rows11 = mysql_fetch_array($sql11))
			{
				echo "<option value='$rows11[0]'> $rows11[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>



        <td align="left">
        <select name = "Bluetooth" id = "Bluetooth" >
        <option value = "0"> Chọn Bluetooth </option>  
        <?php
			$sql17 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 17");
			while ($rows17 = mysql_fetch_array($sql17))
			{
				echo "<option value='$rows17[0]'> $rows17[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
        
        <td align="left">
        <select name = "ManHinh" id = "ManHinh" >
        <option value = "0"> Chọn Màn Hình </option>  
        <?php
			$sql6 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 6");
			while ($rows6 = mysql_fetch_array($sql6))
			{
				echo "<option value='$rows6[0]'> $rows6[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </tr>
        <tr>
        
        </td>
<td align="left">
        <select name = "EDGE" id = "EDGE" >
        <option value = "0"> Chọn EDGE </option>  
        <?php
			$sql14 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 14");
			while ($rows14 = mysql_fetch_array($sql14))
			{
				echo "<option value='$rows14[0]'> $rows14[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
<td align="left">
        <select name = "CongUSB" id = "CongUSB" >
        <option value = "0"> Chọn Cổng USB </option>  
        <?php
			$sql19 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 19");
			while ($rows19 = mysql_fetch_array($sql19))
			{
				echo "<option value='$rows19[0]'> $rows19[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>

<td align="left">
        <select name = "Camera" id = "Camera" >
        <option value = "0"> Chọn Camera </option>  
        <?php
			$sql20 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 20");
			while ($rows20 = mysql_fetch_array($sql20))
			{
				echo "<option value='$rows20[0]'> $rows20[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
       <td align="left">
        <select name = "TrongLuong" id = "TrongLuong" >
        <option value = "0"> Chọn Trọng Lượng </option>  
        <?php
			$sql5 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 5");
			while ($rows5 = mysql_fetch_array($sql5))
			{
				echo "<option value='$rows5[0]'> $rows5[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>
        </tr>
        <tr>
	

</tr>

<td align="center" colspan="4">
        <select name = "GPRS" id = "GPRS" >
        <option value = "0"> Chọn GPRS </option>  
        <?php
			$sql13 = mysql_query("select chitietdd.mact,chitietdd.tenct from chitietdd, dacdiem where dacdiem.madd = chitietdd.madd and dacdiem.madd = 13");
			while ($rows13 = mysql_fetch_array($sql13))
			{
				echo "<option value='$rows13[0]'> $rows13[1] </option>";	
			}		
		 ?>
        </select><br><br>
        </td>

        <tr>
        <td colspan="5" align="center"><br><br> <input type = "submit" name = "submit" id = "submit" value= " Tìm Kiếm Nâng Cao "/><br><br>
        </td>
        </tr>
        </table>
        </form>
        <br>
		<br>
		
		<div id = "mheader">
		<span>
        Kết quả tìm kiếm
        </span>
		</div>
		 <div class = "pro5" id = "pro5">
         </div>
         </div>
        
  </div>
		<div class="clr"></div>

</div>
</body>
</html>

